package com.bsfcs.rag.enums;

import org.springframework.util.StringUtils;

import java.util.Objects;

public enum ContractCategory {
    EXTERNAL_CONTRACT("A", "外部合同"),
    INTERNAL_CONTRACT("B", "内部合同"),
    QUALIFICATIONS_OF_OTHER_COMPANIES("C", "用其他公司资质签订合同"),
    DEFAULT("", "");




    private final String code;
    private final String displayName;

    ContractCategory(String code, String displayName) {
        this.code = code;
        this.displayName = displayName;
    }

    public String getCode() {
        return code;
    }

    public String getDisplayName() {
        return displayName;
    }

    public static ContractCategory fromCode(String code) {

        for (ContractCategory value : ContractCategory.values()) {
            if (Objects.equals(value.getCode(), code)) {
                return value;
            }
        }
        return DEFAULT;
    }
}
